<!DOCTYPE html>
<html>



<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>矩阵互动</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) { window.top.location = window.location; }
    </script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown" style="margin-top:200px;">
        <div>

            <h3>欢迎使用</h3>

            <form class="m-t" role="form">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="用户名" required="" id="loginUser">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" required="" id="loginPasswd">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" id="loginBtn">登 录</button>


                <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>
                </p>

            </form>
        </div>
    </div>
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script>
        function fecthLogin(userid, userpw, cb) {
            $.post('http://api.juzhen.net/admin/login', { userid: userid, userpw: userpw }, function (data) {
                if (cb) cb(data);
            })
        }

        function fecthRegister(userid, userpw) {
            $.post('http://api.juzhen.net/admin/register', { userid: userid, userpw: userpw }, function () {

            })
        }

        function downTable(name) {
            var url = 'http://api.juzhen.net/admin/downtable?tableName=' + name + '&token=' + localStorage.getItem('local_token');

            location.href = url
        }

        // 登陆
        $('#loginBtn').click(function () {
            fecthLogin('xiexiaofei', 'xiexiaofei', function (data) {
                localStorage.setItem('local_token', data.token)

                downTable('checkin_yuexiu_0929');
            });
        })
    </script>

</body>

</html>